from datetime import datetime, timedelta, timezone
now = datetime.now()
print(now)


dt = datetime(2015, 4, 19, 12, 20) # 用指定日期时间创建datetime
print(dt)

dt = datetime(2015, 4, 19, 12, 20)
print(dt.timestamp())
print(datetime.fromtimestamp(dt.timestamp()))
print(datetime.utcfromtimestamp(dt.timestamp()))

cday = datetime.strptime('2015-6-1 18:19:59', '%Y-%m-%d %H:%M:%S')
print(cday)

now = datetime.now()
print(now.strftime('%a, %b %d %H:%M'))


tz_utc_8 = timezone(timedelta(hours=8)) # 创建时区UTC+8:00
now = datetime.now()
print(now)
dt = now.replace(tzinfo=tz_utc_8)
print(dt)